//
//  SongerDataTableViewCell.m
//  NewMusic
//
//  Created by chuxinyu123 on 15/11/18.
//  Copyright © 2015年 Going. All rights reserved.
//

#import "SongerDataTableViewCell.h"
#import <UIImageView+WebCache.h>
#import <SDWebImageManager.h>


@interface SongerDataTableViewCell ()

@end

@implementation SongerDataTableViewCell

- (void)dealloc
{
    [_singer_nameLabel release];
    [_buttonImage release];
    [_pic_urlImage release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self buildSongerDataCell];
    }
    return self;
}

- (void)buildSongerDataCell
{
    self.singer_nameLabel = [[UILabel alloc] init];
    self.singer_nameLabel.textColor = [UIColor whiteColor];
    self.pic_urlImage = [[UIImageView alloc] init];
    _pic_urlImage.layer.shadowColor = [UIColor whiteColor].CGColor;
    _pic_urlImage.layer.shadowOffset = CGSizeMake(5, -5);
    _pic_urlImage.layer.shadowOpacity = 0.5;
    self.buttonImage = [[UIImageView alloc] init];
    
    [self.contentView addSubview:_pic_urlImage];
    [self.contentView addSubview:_singer_nameLabel];
    [self.contentView addSubview:_buttonImage];
    
    
    [_buttonImage release];
    [_pic_urlImage release];
    [_singer_nameLabel release];
    
}

- (void)layoutSubviews
{
    _pic_urlImage.frame = CGRectMake(20, 15, 66, 66);
    _singer_nameLabel.frame = CGRectMake(150, (self.frame.size.height - 30) / 2, 100, 30);
    _buttonImage.frame = CGRectMake(375 - 60, (self.frame.size.height - 20) / 2, 20, 20);
}

- (void)setSongerDataModel:(SongerDataModel *)songerDataModel
{
    if (_songerDataModel != songerDataModel) {
        [_songerDataModel release];
        _songerDataModel = [songerDataModel retain];
    }
    _singer_nameLabel.text = songerDataModel.singer_name;
    [_pic_urlImage sd_setImageWithURL:[NSURL URLWithString:songerDataModel.pic_url]];
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
